package work.ib.apt.perf.review;


import java.util.HashMap;
import java.util.Map;
import java.util.Random;

import work.ib.apt.perf.TestMain;

public class GetReviewAverageRatings extends TestMain {

//	private static final String url = "http://localhost:8000/services/review/v1/getReviewAverageRating";
	private static final String url = "http://dev-aptratings-services1.internetbrands.com:8080/services/review/v1/getReviewAverageRating";


	private static final Integer parallelThreads = 4;

	// Some reviews ids, taken from dev DB
	private static String[] complexReviewIds = new String[] {
		 "111192632,7704242231301441",
		 "991590,602863020285022",
		 "297219,817430124076262",
		 "504090,704365466328211",
		 "674715,281537028077066",
		 "301458,734434040048108",
		 "111237426,703706007622314",
		 "1404297,866203752820852",
		 "111215933,301490302120708",
		 "376775,703830270020121",
		 "174660,309692303361615",
		 "1210755,281479888577571",
		 "111313502,253838740098023",
		 "111394552,949713310092688",
		 "624072,248471484848335",
		 "1224207,214954413175202",
		 "887128,312587940060610",
		 "657434,517882804648911",
		 "781428,706736629930909",
		 "845587,860649849006040",
		 "886962,602997589485020",
		 "253138,919878858527615",
		 "111135169,810949570048047",
		 "246986,703671320022204",
		 "839252,937427118845431",
		 "775767,423265743137402",
		 "1210730,608257156153703",
		 "395912,509783620099336",
		 "1042823,949215736892656",
		 "1655326,619276177592110",
		 "111229953,804321350923227",
		 "111173287,614529427843016",
		 "795602,781239148002215",
		 "878489,704525937528209",
		 "1142670,615833564337211",
		 "1082998,972556219175063",
		 "111381518,4106861277212201",
		 "111308754,312944223260610",
		 "111137180,410661649721236",
		 "296731,317273219046123",
		 "1307447,216579976644113",
		 "1505618,269488331749006",
		 "1230657,817460244776013",
		 "1263990,214871080075201",
		 "1492005,215473480319131",
		 "1134430,206794456798199",
		 "932113,317859154046143",
		 "696701,636391901063021",
		 "1585122,610363555119341",
		 "1391270,303457350280241",
		 "678199,202362420120016",
		 "111180987,207878881804103",
		 "391562,866319451828411",
		 "895070,330645607144312",
		 "1166103,602218632085014",
		 "10636,305270943033156",
		 "434799,520323934785704",
		 "990611,253840405498373",
		 "1611721,888237077231210",
		 "111283941,540213023424401",
		 "1309770,407657001132817",
		 "100998,215883200019131",
		 "787353,903758056975605",
		 "1473590,419535780143606",
		 "111226062,888688496221014",
		 "111170381,201796913807407",
		 "658215,503661699997030",
		 "1635160,93003",
		 "614186,480966854085281",
		 "1559896,913897669666213",
		 "1459330,281879996677099",
		 "154619,972864862675043",
		 "1121925,512531055578730",
		 "861608,904641157532246",
		 "246852,734482300048197",
		 "1316238,517349261448840",
		 "1526072,719579691480906",
		 "111307365,785272833366604",
		 "126397,972662600075287",
		 "813081,651739410055101",
		 "111342286,770934724430340",
		 "1579171,952925387855414",
		 "198153,610558684819342",
		 "1043124,409569941375961",
		 "111293668,317858170146112",
		 "795927,410628177721030",
		 "172962,770901999930338",
		 "464134,859273750040515",
		 "111328526,713528652277004",
		 "1445455,702990239989147",
		 "1460716,918296006274137",
		 "451210,310208445490024",
		 "166034,301894070020748",
		 "1466230,916624258895677",
		 "1639277,888266140945246",
		 "111353384,609921606008540",
		 "422198,619934400091913",
		 "560456,301948918820878",
		 "670812,770277848430044",
		 "266067,617782135202135",

	};

	public static void main(String[] args) {
		try {
			new GetReviewAverageRatings().runTest();
		} catch (Exception e) {
			e.printStackTrace(System.out);
		}
	}

	@Override
	public Map<String, Object> getParameters() {
		String[] dataArray = complexReviewIds;
		String[] ids = dataArray[new Random().nextInt(dataArray.length)].split(",");
		Map<String,Object> params = new HashMap<String,Object>();

		params.put("reviewId", ids[0]);
		params.put("complexId", ids[1]);
		params.put("format", "json");

		return params;
	}

	@Override
	public int getParallelThreads() {
		return parallelThreads;
	}

	@Override
	public String getURL() {
		return url;
	}
}
